<div id="main" role="main">
		<div class="tab-content tab-addtabs">
			<div id="content">
				<div class="row">
					<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
						 <div class="content">
							<form class="layui-form" >
									<div class="layui-form-item">
										<label class="layui-form-label">
											模型名称
										</label>
										<div class="layui-input-block">
											<input type="text" class="layui-input" id="name" value="{$info.im_name}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">
											模型表名
										</label>
										<div class="layui-input-block">
											<input type="text" class="layui-input" id="table" value="{$info.im_table}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">
											模型描述
										</label>
										<div class="layui-input-block">
											<textarea class="layui-textarea" id="des">{$info.im_des}</textarea>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">
											模板类型
										</label>
										<div class="layui-input-block">
											<input type="checkbox" name="type" lay-skin="switch" lay-text="共用|分离" {if condition="$info['im_type']==1"}checked{/if}>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">
											创建附表
										</label>
										<div class="layui-input-block">
											<input type="checkbox" name="data" lay-skin="switch" lay-text="否|是" {if condition="$info['im_class']==1"}checked{/if}>
										</div>
									</div>
									

							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

												
<script>
layui.use(['form'], function(){
	var form = layui.form;
});

function doSubimt() {
	var res;
	var name        = $('#name').val();
	var table       = $('#table').val();
	var des         = $('#des').val();
	var type        = 0;
	var clas        = 0;
	if ($("input[name='type']").is(':checked')) {
		type = 1;
	}
	if ($("input[name='data']").is(':checked')) {
		clas = 1;
	}
	var data = {'pid':'{$info.im_id}','name':name,'table':table,'des':des,'type':type,'class':clas};

	if (name == '') {
		$.thinkmimi({Content : '请输入模型名称', Type:2, Align:'right', OutTime:2000});return false;
	}
	if (table == '') {
		$.thinkmimi({Content : '请输入模型表名', Type:2, Align:'right', OutTime:2000});return false;
	}

	$.ajax({
		type: 'post',
		data: data,
		async: false,
		url: "{:url('upd')}",
		success: function(data) {
			var array = eval('('+data+')');
			res = array;
			if (array['code'] == '01') {
				$.thinkmimi({Content : array['msg'], Type:2, Align:'right', OutTime:2000});
				res = false;
			}
		}
	});

	return res;
}
</script>